# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudScheduler.V1.Model.PubsubTarget do
  @moduledoc """
  Pub/Sub target. The job will be delivered by publishing a message to the given Pub/Sub topic.

  ## Attributes

  *   `attributes` (*type:* `map()`, *default:* `nil`) - Attributes for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute.
  *   `data` (*type:* `String.t`, *default:* `nil`) - The message payload for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute.
  *   `topicName` (*type:* `String.t`, *default:* `nil`) - Required. The name of the Cloud Pub/Sub topic to which messages will be published when a job is delivered. The topic name must be in the same format as required by Pub/Sub's [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), for example `projects/PROJECT_ID/topics/TOPIC_ID`. The topic must be in the same project as the Cloud Scheduler job.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :attributes => map() | nil,
          :data => String.t() | nil,
          :topicName => String.t() | nil
        }

  field(:attributes, type: :map)
  field(:data)
  field(:topicName)
end

defimpl Poison.Decoder, for: GoogleApi.CloudScheduler.V1.Model.PubsubTarget do
  def decode(value, options) do
    GoogleApi.CloudScheduler.V1.Model.PubsubTarget.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudScheduler.V1.Model.PubsubTarget do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
